package dancrawler.client;

import java.util.HashMap;
import java.util.List;

/**
 *  A central register of all gameObjects
 */
public class GameObjectRegister {
    private HashMap<Integer,GameObject> objects = new HashMap<>(); 
    
    public void removeGameObject(GameObject obj)
    {
        int id = obj.getId();
        if(id == 0)
        {
            return;
        }
        else
        {
            objects.remove(id);
        }
    }
    
    public void registerGameObject(GameObject obj, int id)
    {
        removeGameObject(obj);
        objects.put(id, obj);
    }
    
    public GameObject getGameObject(int id)
    {
        return objects.get(id);
    }
    
}
